<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--xmlns="http://www.w3.org/1999/xhtml">
	<xsl:output
		method="html"
		doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
	/> -->
	<xsl:variable name="header">
		<thead>
			<tr>
				<th>Course name</th>
				<th>Credit</th>
				<th>gNumber</th>
				<th>Start</th>
				<th>End</th>
				<th>Course page</th>
			</tr>
		</thead>
	</xsl:variable>
	<xsl:template match="/">
		<h1>SUNDAY</h1>
		<div class="timeline">
		<table border="3" width="70%">
		<xsl:copy-of select="$header"></xsl:copy-of>
				<tbody>
		<xsl:for-each select="calendar//session">
			<xsl:sort select="start" data-type="number"/>
			<xsl:if test="day='SUN'">
				<xsl:apply-templates select="."/>
			</xsl:if>
		</xsl:for-each>
			</tbody>
		</table>
		</div>
		
		<h1>MONDAY</h1>
		<div class="timeline">
		<table border="3" width="70%">
		<xsl:copy-of select="$header"></xsl:copy-of>
				<tbody>
		<xsl:for-each select="calendar//session">
			<xsl:sort select="start" data-type="number"/>
			<xsl:if test="day='MON'">
				<xsl:apply-templates select="."/>
			</xsl:if>
		</xsl:for-each>
			</tbody>
		</table>
		</div>
		
		<h1>TUESDAY</h1>
		<div class="timeline">
		<table border="3" width="70%">
		<xsl:copy-of select="$header"></xsl:copy-of>
				<tbody>
		<xsl:for-each select="calendar//session">
			<xsl:sort select="start" data-type="number"/>
			<xsl:if test="day='TUE'">
				<xsl:apply-templates select="."/>
			</xsl:if>
		</xsl:for-each>
			</tbody>
		</table>
		</div>
		
		<h1>WEDNESDAY</h1>
		<div class="timeline">
		<table border="3" width="70%">
		<xsl:copy-of select="$header"></xsl:copy-of>
				<tbody>
		<xsl:for-each select="calendar//session">
			<xsl:sort select="start" data-type="number"/>
			<xsl:if test="day='WED'">
				<xsl:apply-templates select="."/>
			</xsl:if>
		</xsl:for-each>
			</tbody>
		</table>
		</div>
		
		<h1>THURSDAY</h1>
		<div class="timeline">
		<table border="3" width="70%">
		<xsl:copy-of select="$header"></xsl:copy-of>
				<tbody>
		<xsl:for-each select="calendar//session">
			<xsl:sort select="start" data-type="number"/>
			<xsl:if test="day='THU'">
				<xsl:apply-templates select="."/>
			</xsl:if>
		</xsl:for-each>
			</tbody>
		</table>
		</div>
		
		<h1>FRIDAY</h1>
		<div class="timeline">
		<table border="3" width="70%">
		<xsl:copy-of select="$header"></xsl:copy-of>
				<tbody>
		<xsl:for-each select="calendar//session">
			<xsl:sort select="start" data-type="number"/>
			<xsl:if test="day='FRI'">
				<xsl:apply-templates select="."/>
			</xsl:if>
		</xsl:for-each>
			</tbody>
		</table>
		</div>
		
		<h1>SATURDAY</h1>
		<div class="timeline">
		<table border="3" width="70%">
		<xsl:copy-of select="$header"></xsl:copy-of>
				<tbody>
		<xsl:for-each select="calendar//session">
			<xsl:sort select="start" data-type="number"/>
			<xsl:if test="day='SAT'">
				<xsl:apply-templates select="."/>
			</xsl:if>
		</xsl:for-each>
			</tbody>
		</table>
		</div>
		
	</xsl:template>
	<xsl:template match="session">
		<tr align="center">
			<td><xsl:value-of select="../title"/></td>
			<td><xsl:value-of select="../credit"/></td>
			<td><xsl:value-of select="../gnumber"/></td>
			<td><xsl:value-of select="start"/>:00</td>
			<td><xsl:value-of select="end"/>:00</td>
			<td><a href="/salonmorandsmigi/course.jsp?name={../title}">Course page</a></td>
		</tr>
	</xsl:template>
</xsl:stylesheet>